package sc

import scala.collection.mutable.ListBuffer

object Main {
  def main(args: Array[String]): Unit = {
    println("Hello world!")
    var i1 = 1;
    var i2 = 1 to 10;
    for(i <- i2){
      println(i)
    }
    //list 不可变
    println(i2.toList)
    var i3 = i2.toList
    val list = i3.::(3)
    println(i3)
    println(list)
    println(i3.take(4))
    println(i3.toIndexedSeq)
    println(i2.toVector)
    var i4 = i2.toSeq
    println(i4)
    var i5 = i2.toSet
    println(i5)
    var i6 = i2.toBuffer
    println(i6)
    val i7 :Unit =()
    println(i7)

    val listBuffer = ListBuffer(1, 2, 3, 4, 5)
    val ints = ListBuffer(6, 7, 8, 9,10)
    val tuples = ints.zip(listBuffer)
    val list1 = tuples.map(e => e._1 + e._2).toList
    println(list1)
    var l1 = List(1)
    println(l1:+0)
    while (l1.length<10){
      l1=l1.:+(0).zip(l1.+:(0)).map(e => e._1 + e._2)
      println(l1)
    }
    println(List(1,1,2,1,3).zip((List(13, 12, 35, 32, 12))).toMap)

    val ints1 = List(1,1, 23, 4)
    val map1 = ints1.map(e=>(e,e)).toMap
    println(map1)

    val set1 =Set(1,2,3,4,5,6,7)
    val set2 =Set(5,6,7,8,9,10)
    println(set1 -- set2)
    println((1,3).→(2))
  }
}